#include "Transaction.hh"
#include <ctime>
#include <sstream>
#include <iomanip>

namespace BankingSystem {

unsigned long Transaction::nextId = 1; // Initialize global transaction ID counter

Transaction::Transaction(const std::string& id, double amt, const std::string& transactionType, const std::string& transactionNote)
    : transactionId(id), amount(amt), type(transactionType), note(transactionNote) {
    std::time_t now = std::time(nullptr);
    std::stringstream ss;
    ss << std::put_time(std::localtime(&now), "%Y-%m-%d %H:%M:%S");
    date = ss.str();
}

} // namespace BankingSystem